<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Promise</title>
</head>

<body>
    <h1>Promise</h1>

    <script>
        let a = 1
        async function foo() {
            await new Promise((resolve, reject) => {
                for (let i = 1; i < 30; i++) {
                    a++;
                }
                resolve();
            });
        }
        console.log(a);
        foo()
        console.log(a);
    </script>
</body>

</html>